#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;

// some comparers
inline bool lessFunc(int lval, int rval)
{
    return lval < rval;
}

typedef struct lessStruct
{
    bool operator ()(int lval, int rval)
    {
        return lval < rval;
    }
} less_struct;

class lessClass
{
public:
    bool operator ()(int lval, int rval)
    {
        return lval < rval;
    }
};

// data vector
void initData(vector<int> & vec, const size_t & size)
{
    srand(time(NULL));
    for (int i=0; i<size; i++) {
        vec.push_back(rand());
    }
}

void printData(const vector<int> & vec)
{
    for (int i=0; i<vec.size(); i++) {
        cout << i << "\t" << vec[i] << endl;
    }
}

int main(int argc, char *argv[])
{
    vector<int> vecData;
    initData(vecData, 100);
    printData(vecData);
    //sort(vecData.begin(), vecData.end(), lessFunc);
    //sort(vecData.begin(), vecData.end(), less_struct);
    sort(vecData.begin(), vecData.end(), lessClass());
    printData(vecData);
    return 0;
}

